package com.quanyan.assets.enums;

/**
 * Created by wmb on 2016/10/11.
 */
public enum SportType {
    BASKETBALL(1,"篮球"),
    BADMINTON(2,"羽毛球"),
    FOOTBALL(3,"足球"),
    TENNIS(4,"网球"),
    RIDING(11,"骑行"),
    RUNNING(12,"跑步"),
    ;
    SportType(Integer id, String name){
        this.id=id;
        this.name=name;
    }

    public static String getNameById(Integer id) {
        if(null==id){
            return null;
        }
        for(SportType tmp: SportType.values()) {
            if(tmp.id.intValue() == id.intValue()) {
                return tmp.getName();
            }
        }
        return null;
    }

    public static SportType getById(Integer id) {
        if(null==id){
            return null;
        }
        for(SportType tmp: SportType.values()) {
            if(tmp.id.intValue() == id.intValue()) {
                return tmp;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer id;
    public String name;
}
